<template>
	<view>
		<my-scroll-list ref="ScroolList" :requestUrl="requestUrl">
			<template #ScrollMyList="{contentScrollList}">
				<MakeVisitList @GoToPage="GoToPage" :ScrollList="contentScrollList" v-if="param.title=='预约参观'"></MakeVisitList>
				<cleanEquipmentList :param="param" :ScrollList="contentScrollList" v-else-if="param.title.indexOf('日常')!=-1"></cleanEquipmentList>
				<meetingList @GoToPage="GoToPage" :ScrollList="contentScrollList" v-else-if="param.title=='会议预定'"></meetingList>
		    </template>
		</my-scroll-list>
		<view class="SaveNew" @click="GoToPage('')">
			<u-icon name="plus" size="25" color="#ffffff"></u-icon>
		</view>
	</view>
</template>

<script>
	import {setNavTitle,skipPage} from '@/utils/common.js'
	import MakeVisitList from "./MakeVisitList.vue"
	import cleanEquipmentList from "./cleanEquipmentList.vue"
	import meetingList from "./meetingList.vue"
	export default {
		data() {
			return {
				param:{title:''},//接收参数
				requestUrl:'',
			};
		},
		components:{
			MakeVisitList,cleanEquipmentList,meetingList
		},
		methods:{
			GoToPage(id){
				let name='添加'+this.param.title
				let pageUrl=''
				if(id){
					name=this.param.title+'详情'
				}
				if(this.param.title=='预约参观'){
					pageUrl='MakeVisit'
				}else if(this.param.title=='会议预定'){
					pageUrl='meeting'
				}
				skipPage(`/subpkg/${pageUrl}/${pageUrl}?title=${name}&id=${id}`)
			}
		},
		onReady(){//监听页面初次渲染完成
			setNavTitle(this.param.title)//设置导航栏标题
		},
		onLoad(option) {
			this.param=option
			if(this.param.title=='预约参观'){
				this.requestUrl='/yzyVisitAppointment/list'
			}else if(this.param.title=='日常清洁'){
				this.requestUrl='/parkDaily/list'
			}else if(this.param.title=='日常巡检'){
				this.requestUrl='/inspectionEquipment/list'
			}else if(this.param.title=='会议预定'){
				this.requestUrl='/reservationRoom/list'
			}
		},
		onShow() {
			// if(getApp().globalData.ifImplementonShow){
			// 	this.$refs.ScroolList.getListData(false,true,{},this.requestUrl)
			// 	getApp().globalData.ifImplementonShow=false
			// 	this.ifImplementonShow=false
			// 	console.log(getApp().globalData.ifImplementonShow,"执行")
			// }
			this.$refs.ScroolList.getListData(false,true,{},this.requestUrl)
			
		}
	}
</script>

<style lang="scss">

</style>
